﻿namespace NavigationSampleWinForms.Views.Data
{
    using System;

    using Smart.Navigation;
    using Smart.Navigation.Parameter;

    /// <summary>
    /// 
    /// </summary>
    [View(ViewId.DataList)]
    public partial class DataListView : AppViewBase
    {
        [ViewParameter(Direction.Export)]
        protected string SelectedId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public DataListView()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnButtonExit()
        {
            Navigator.Forward(ViewId.Menu);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public override void OnViewOpen(ViewForwardEventArgs args)
        {
            // ファンクションキー
            FunctionCotrol.UpdateFunctionKeys(null);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NewButtonClick(object sender, EventArgs e)
        {
            Navigator.Push(ViewId.DataDetailNew);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditButtonClick(object sender, EventArgs e)
        {
            // データ123選択
            SelectedId = "123";

            Navigator.Push(ViewId.DataDetailEdit);
        }
    }
}